﻿@model WTM524.ViewModels.SchoolVMs.SchoolListVM
@inject IStringLocalizer<Program> Localizer;

<wt:searchpanel vm="@Model" reset-btn="true">
    <wt:row items-per-row="ItemsPerRowEnum.Three">
        <wt:textbox field="Searcher.SchoolName" />
        <wt:combobox field="Searcher.SchoolType" empty-text="@Localizer["Sys.All"]" />
    </wt:row>
</wt:searchpanel>
<table id="user" lay-filter="user"></table>
<wt:grid vm="@Model" url="/School/Search" editable="true" />

<script>
    @{
        string id = $"wtTable_{Model.UniqueId}";
    }
    //监听编辑事件
    layui.table.on('edit(@id)', obj => {
        console.log("编辑"+obj);
    });

    //监听点击事件
    layui.table.on('row(@id)', obj => {
        console.log("点击"+obj);
    });

    //用户table
    layui.table.render({
        elem: '#user'
        ,id:'user'
        , url: null
        , cols: [[
            { type: "numbers"}
           ,{ field: 'Name',title:'姓名',edit:'text' }
        ]]
        , data: [
            { Name: '张三' }
            , {Name:'李四'}
        ]
    });
    layui.table.on('edit(user)', obj => {
        console.log("用户表"+obj);
    });
    layui.table.on('row(user)', obj => {
        console.log("用户表点击" + obj);
    });


    $(window).bind('resize',() => {
        console.log('resize');
    });
</script>